//
//  YJBTradeMarkSectionView.m
//  YunJiaBaoFirst
//
//  Created by 腾云小白龍 on 16/7/28.
//  Copyright © 2016年 腾云小白龍. All rights reserved.
//

#import "YJBTradeMarkSectionView.h"

@implementation YJBTradeMarkSectionView

-(id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
    }
    return self;
}

-(void)initView{
    
    UILabel * nameLabel = [[UILabel alloc] init];
    nameLabel.font = [UIFont systemFontOfSize:14];
    nameLabel.textColor = [UIColor blackColor];
    nameLabel.numberOfLines = 0;
    nameLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:nameLabel];
    
    UILabel * codeLabel = [[UILabel alloc] init];
    codeLabel.textAlignment = NSTextAlignmentCenter;
    codeLabel.font = [UIFont systemFontOfSize:14];
    codeLabel.textColor = [UIColor grayColor];
    [self addSubview:codeLabel];
    
    UILabel * nowPriceLabel = [[UILabel alloc] init];
    nowPriceLabel.textColor = [UIColor blackColor];
    nowPriceLabel.font = [UIFont systemFontOfSize:14];
    nowPriceLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:nowPriceLabel];
    
    UILabel * nowCountLabel = [[UILabel alloc] init];
    nowCountLabel = nowCountLabel;
    nowCountLabel.textColor = [UIColor grayColor];
    nowCountLabel.textAlignment = NSTextAlignmentCenter;
    nowCountLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:nowCountLabel];
    
    UILabel * buyPriceLabel = [[UILabel alloc] init];
    buyPriceLabel = buyPriceLabel;
    buyPriceLabel.textColor = [UIColor blackColor];
    buyPriceLabel.textAlignment = NSTextAlignmentCenter;
    buyPriceLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:buyPriceLabel];
    
    UILabel * buyCountLabel = [[UILabel alloc] init];
    buyCountLabel.textAlignment = NSTextAlignmentCenter;
    buyCountLabel.textColor = [UIColor grayColor];
    buyCountLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:buyCountLabel];
    
    UILabel * sellPriceLabel = [[UILabel alloc] init];
    sellPriceLabel = sellPriceLabel;
    sellPriceLabel.textAlignment = NSTextAlignmentCenter;
    sellPriceLabel.textColor = [UIColor blackColor];
    sellPriceLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:sellPriceLabel];
    
    UILabel * sellCountLabel = [[UILabel alloc] init];
    sellCountLabel.textAlignment = NSTextAlignmentCenter;
    sellCountLabel.textColor = [UIColor grayColor];
    sellCountLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:sellCountLabel];
    
    UILabel * percentLabel = [[UILabel alloc] init];

    percentLabel.textAlignment = NSTextAlignmentCenter;
//    percentLabel.textColor = [UIColor redColor];
    percentLabel.font = [UIFont systemFontOfSize:17];
    [self addSubview:percentLabel];
    
    CGRect nameLabelF = CGRectMake(5, 5, SCREEN_WIDTH / 5 - 10, 14);
    CGRect codeLabelF = CGRectMake(5, CGRectGetMaxY(nameLabelF) + 5, SCREEN_WIDTH / 5 - 10, 14);
    
    CGFloat totalH = CGRectGetHeight(nameLabelF) + CGRectGetHeight(codeLabelF) + 5 + 5 + 5;
    CGFloat priceH = 14 + 5 + 14;
    
    CGFloat priceY = (totalH - priceH) / 2;
    
    CGRect nowPriceLabelF = CGRectMake(CGRectGetMaxX(nameLabelF) + 5, priceY, SCREEN_WIDTH / 5 - 10, 14);
    CGRect nowCountLabelF = CGRectMake(CGRectGetMaxX(codeLabelF) + 5, CGRectGetMaxY(nowPriceLabelF) + 5, SCREEN_WIDTH / 5 - 10, 14);
    
    CGRect buyPriceLabelF = CGRectMake(CGRectGetMaxX(nowPriceLabelF) + 5, priceY, SCREEN_WIDTH / 5 - 10, 14);
    CGRect buyCountLabelF = CGRectMake(CGRectGetMaxX(nowCountLabelF) + 5, CGRectGetMaxY(buyPriceLabelF) + 5, SCREEN_WIDTH / 5 - 10, 14);
    
    CGRect sellPriceLabelF = CGRectMake(CGRectGetMaxX(buyPriceLabelF) + 5, priceY, SCREEN_WIDTH / 5 - 10, 14);
    CGRect sellCountLabelF = CGRectMake(CGRectGetMaxX(buyCountLabelF) + 5, CGRectGetMaxY(sellPriceLabelF) + 5, SCREEN_WIDTH / 5 - 10, 14);
    
    CGFloat cellHeight = CGRectGetMaxY(codeLabelF) + 5;
    
    CGRect percentLabelF = CGRectMake(CGRectGetMaxX(sellPriceLabelF), 0, SCREEN_WIDTH / 5, cellHeight);
    nameLabel.text = @"类型";
    nameLabel.frame = nameLabelF;
    
    codeLabel.text = @"(代号)";
    codeLabel.frame = codeLabelF;
    
    nowPriceLabel.text = @"现价";
    nowPriceLabel.frame = nowPriceLabelF;
    
    nowCountLabel.text = @"(现手)";
    nowCountLabel.frame = nowCountLabelF;
    
    buyPriceLabel.text = @"买价";
    buyPriceLabel.frame = buyPriceLabelF;
    
    buyCountLabel.text = @"(买量)";
    buyCountLabel.frame = buyCountLabelF;
    
    sellPriceLabel.text = @"卖价";
    sellPriceLabel.frame = sellPriceLabelF;
    
    sellCountLabel.text = @"(卖量)";
    sellCountLabel.frame = sellCountLabelF;
    
    percentLabel.text = @"涨跌幅";
    percentLabel.frame = percentLabelF;
    
    
}

@end
